﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="废料发货登记.aspx.cs" Inherits="syc.Store.废料发货登记" %>

<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="select @废料ID=废料ID,@单位ID=单位ID,@数量=数量,@日期=日期,@备注=备注,@规格=规格 from 废料到发记录 t1
left outer join 废料 t2 on t2.id=t1.废料ID where t1.ID=@ID;"

InsertCommand="insert into 废料到发记录(废料ID,单位ID,数量,日期,备注,发货)
values(@废料ID,@单位ID,@数量,@日期,@备注,1);set @ID=@@IDENTITY;"

UpdateCommand="update 废料到发记录 set 废料ID=@废料ID,单位ID=@单位ID,数量=@数量,日期=@日期,备注=@备注 where ID=@ID;"
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
oninserted="SqlDataSource1_Inserted" onselected="SqlDataSource1_Selected" >
<SelectParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" />
<asp:Parameter Name="废料ID" DbType="Int32" Size="4" Direction="Output" />

<asp:Parameter Name="单位ID" DbType="Int32" Size="4" Direction="Output" />
<asp:Parameter Name="数量" DbType="Decimal"  Direction="Output" />
<asp:Parameter Name="日期" DbType="Date" Size="3" Direction="Output" />
<asp:Parameter Name="备注" DbType="String"  Size="100" Direction="Output" />
<asp:Parameter Name="规格" DbType="AnsiString" Size="40" Direction="Output" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" Direction="Output" />
<asp:ControlParameter Name="废料ID" DbType="Int32" Size="4" ControlID="LeiBie"/>
<asp:ControlParameter Name="单位ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="数量" DbType="Decimal"  ControlID="ShuLiang" />
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1" />
<asp:ControlParameter Name="备注" DbType="String"  Size="100" ControlID="BeiZhu" />
<asp:Parameter Name="保管员" DbType="String" Size="20" />
</InsertParameters>
<UpdateParameters>
<asp:ControlParameter Name="ID" DbType="Int32" Size="4" ControlID="Label_ID"/>
<asp:ControlParameter Name="废料ID" DbType="Int32" Size="4" ControlID="LeiBie"/>
<asp:ControlParameter Name="单位ID" DbType="Int32" Size="4" ControlID="FenChang" />
<asp:ControlParameter Name="数量" DbType="Decimal"   ControlID="ShuLiang"  />
<asp:ControlParameter Name="日期" DbType="Date" Size="3" ControlID="Date1"  />
<asp:ControlParameter Name="备注" DbType="String"  Size="100" ControlID="BeiZhu" />
<asp:Parameter Name="保管员" DbType="String" Size="20" />
</UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select ID, 单位 FROM 单位设置"></asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="SELECT [废料名称], ID  FROM 废料"></asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource4" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID], [规格] FROM [废料]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource5" runat="server" 
    ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
    SelectCommand="SELECT [ID], [单位] FROM [废料]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource6" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select ID, 名称 FROM 废料收货单位"></asp:SqlDataSource>

<asp:Label ID="Label_ID" runat="server" Text="0" Visible="false"></asp:Label>

<div id="wintop" class="wintop">废料发货</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
<asp:Button ID="Button_Save" runat="server" Text="保 存" UseSubmitBehavior="false" 
        CssClass="button" onclick="Button_Save_Click"/>
<input type="button" value="关 闭" class="button" onclick="parent.swin2_close();" />
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" CssClass="panel">
<table border=1 height=240 style="border-collapse:separate;font-size:14px;margin-top:7px;margin-bottom:24px;">
<tr>
<td colspan=4 align=center style="font-weight:bold; letter-spacing:6px;font-size:16px;border:none;">
    废料发货信息</td>
</tr>
<tr>
<td align=right>收货单位：</td>
<td><asp:DropDownList ID="FenChang" runat="server" DataSourceID="SqlDataSource6" Width="120px"
        DataTextField="名称" DataValueField="ID">
</asp:DropDownList></td>
<td align=right>日期：</td>
<td><asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="120px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" /></td>
</tr>

<tr>
<td width=100 align=right>废料类别：</td>
<td width=180 style="font-style: italic">
    <asp:DropDownList ID="LeiBie" runat="server" DataSourceID="SqlDataSource3" Width="120px" AutoPostBack="true"
        DataTextField="废料名称" DataValueField="ID" 
        onselectedindexchanged="LeiBie_SelectedIndexChanged">
    </asp:DropDownList>
    </td>
<td width=100 align=right>规格：</td>
<td width=180><asp:Label ID="Label_GuiGe" runat="server" Text="..."></asp:Label>
    <asp:DropDownList ID="GGList" runat="server" DataSourceID="SqlDataSource4" 
        DataTextField="规格" DataValueField="ID" Visible="False">
    </asp:DropDownList>
    </td>
</tr>
<tr>
<td width=100 align=right>单位：</td>
<td width=180><asp:Label ID="Label_DanWei" runat="server" Text="..."></asp:Label>
    <asp:DropDownList ID="DWList" runat="server" DataSourceID="SqlDataSource5" 
        DataTextField="单位" DataValueField="ID" Visible="False">
    </asp:DropDownList>
    </td>
<td width=100 align=right>磅量：</td>
<td width=180><asp:TextBox ID="ShuLiang" runat="server" CssClass="textbox" Width="120"></asp:TextBox></td>
</tr>
<tr>
<td align=right>备注：</td>
<td colspan=3><asp:TextBox ID="BeiZhu" runat="server" CssClass="textbox" Width="300"></asp:TextBox></td>
</tr>
</table>

</asp:Panel>

</form>
<script>
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
   </script>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
            if (e.keyCode == 13) e.keyCode = 9;
        }
    }

    function makecalendar(d, o) {
        obj = o;
        idate = makedate(d);
        cdate = new Date(idate.getFullYear(), idate.getMonth(), 1);
        ds.style.left = (getObjectLeft(o) - 30) + "px";
        ds.style.top = (getObjectTop(o) - 25) + "px";
        ds.style.display = 'block';
        showcalendar();

    }
   
    
</script>
</body>
</html>